package com.wuyou.designPatterns.singleton;

/**
 * 锁代码块：稍微提升性能的防止多线程破坏单例
 */
public class Singleton3 {

    private static Singleton3 singleton3;

    private Singleton3(){}

    public static Singleton3 getInstance(){
        synchronized (Singleton3.class){
            if (singleton3 == null) {
                singleton3 = new Singleton3();
            }
        }
        return singleton3;
    }
}
